class Solution(object):
    def check(self, nums):
        index = 0
        start = [0, 0]
        end = [0, 0]
        start[0] = nums[0]
        end[0] = nums[0]
        for i in range(1, len(nums)):
            if nums[i] >= nums[i - 1]:
                end[index] = nums[i]
            else:
                index += 1
                if index == 1:
                    start[index] = nums[i]
                    end[index] = nums[i]
                else:
                    return False
        if index == 0:
            return True
        else:
            if start[0] >= end[1]:
                return True
            else:
                return False